import sys
from sentence_transformers.util import cos_sim
from sentence_transformers import SentenceTransformer as SBert

model = SBert('E:\\code\\NLP\\data\\paraphrase-multilingual-MiniLM-L12-v2')
# 接收从Java传递的参数
arg1 = sys.argv[1]
arg2 = sys.argv[2]

embeddings1 = model.encode(arg1)
embeddings2 = model.encode(arg2)

# Compute cosine-similarits
cosine_scores = cos_sim(embeddings1, embeddings2)
print(cosine_scores[0][0].item())